package com.zijiebutiao.pojos;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    public static  final  int SUCCESS=10000;//成功
    public static  final  int ERROR=10001;//失败
    public static  final  int NO_LOGIN=20001;//未登入
    public static  final  int NO_AUTH=20002;//没权限
    private int code;//标识结果状态码
    private  String msg;//表示结果描述信息
    private  Object data;//向页面携带的数据
    public  static  Result success(Object data){
        Result result=new Result();
        result.setCode(SUCCESS);
        result.setData(data);
        return  result;
    }
    public  static  Result success(Object data,String msg){
        Result result=new Result();
        result.setCode(SUCCESS);
        result.setData(data);
        result.setMsg(msg);
        return  result;
    }
    public  static  Result error(int code,String msg){
        Result result=new Result();
        result.setCode(code);
        result.setMsg(msg);
        return  result;
    }

}
